<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "set_tabbar".
 *
 * @property int $id
 * @property string $iconPath
 * @property string $selectedIconPath
 * @property string $text
 * @property string $url
 * @property int $isPage
 * @property int $status
 */
class SetTabbar extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'set_tabbar';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['iconPath', 'selectedIconPath', 'text', 'url'], 'required'],
            [['isPage', 'status'], 'integer'],
            [['iconPath', 'selectedIconPath', 'text', 'url'], 'string', 'max' => 255],

            [['sort', 'icon_path', 'selected_icon_path'], 'safe']
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'iconPath' => 'Icon Path',
            'selectedIconPath' => 'Selected Icon Path',
            'text' => 'Text',
            'url' => 'Url',
            'isPage' => 'Is Page',
            'status' => 'Status',
        ];
    }

    public function getIcon()
    {
        return $this->hasOne(Images::class, ['id' => 'icon_path']);
    }

    public function getActiveIcon()
    {
        return $this->hasOne(Images::class, ['id' => 'selected_icon_path']);
    }
}
